package com.chang.controller;

import com.chang.bean.Info;
import com.chang.common.bean.ResultBean;
import com.chang.common.controller.BaseController;
import com.chang.common.group.ISave;
import com.chang.common.group.V;
import com.chang.service.impl.InfoServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @program: erp-api
 * @description: 询价单控制类
 * @author: chang
 * @create: 2025-02-20 14h
 **/
@RestController
@RequestMapping("/api")
@Api(tags = "询价单管理")
public class InfoController extends BaseController {

    @Autowired
    InfoServiceImpl infoService;

    @ApiOperation("保存询价单")
    @PostMapping("/info")
    public ResultBean save(@Validated(ISave.class) @RequestBody Info info, BindingResult result) {
        V.validate(result);
        int rs = infoService.save(info);
        return saveResult(rs);
    }


}
